<!DOCTYPE html>
<html>
<head lang="zh">
	<meta charset="UTF-8">
	<link rel="stylesheet" href="css/base.css">
	<title>Cookie示例</title>
</head>
<body>
<noscript>此文档需要JavaScript支持才能正常使用</noscript>
<!-- 定义页头 -->
<header>
	<h1>这是一个Cookie示例</h1>
	<button id="write">Add Cookie</button>
	<button id="update">Update Cookie</button>
</header>

<!-- 定义边栏，书写说明或者放致导航菜单 -->
<aside>
	<nav>
		<ul>

		</ul>
	</nav>
</aside>
<!-- 定义页面内容 -->
<div id="container">

</div>
<!-- 页面内容结束 -->
<!-- 定义页尾 -->
<footer>

</footer>
<!-- JavaScript脚本链接请在此处插入 -->
<script>
	var cookieCount = 0;
	document.getElementById('update').onclick = updateCookie;
	document.getElementById('write').onclick = createCookie;

	readCookies();

	function readCookies()
	{
		document.getElementById('container').innerHTML = document.cookie;
	}

	function createCookie()
	{
		cookieCount++;
		document.cookie = 'Cookie_' + cookieCount + '=Value_' + cookieCount;
		readCookies();
	}

	function updateCookie()
	{
		document.cookie = 'Cookie_' + cookieCount + '=Updated_' + cookieCount;
		readCookies();
	}
</script>
</body>
</html>